<template>
  <view>
    <view @click="showPosterHandler(1)">分享-1</view>
    <view @click="showPosterHandler(2)">分享-2</view>
    <view @click="showPosterHandler(3)">分享-3</view>
    <!-- 分享海报 -->
    <posterCompt1 :goodObj="detailData" v-if="showPoster1" @closePoster="closePoster1"/>
    <posterCompt2 :goodObj="detailData" v-if="showPoster2" @closePoster="closePoster2"/>
    <posterCompt3 :goodObj="detailData" v-if="showPoster3" @closePoster="closePoster3"/>
  </view>
</template>

<script>
import posterCompt1 from './components/posterCompt1.vue'
import posterCompt2 from './components/posterCompt2.vue'
import posterCompt3 from './components/posterCompt3.vue'
export default {
  components: {
    posterCompt1,
    posterCompt2,
    posterCompt3
  },
  data() {
    return {
      showPoster1: false,
      showPoster2: false,
      showPoster3: false,
      detailData: {
        coupon: 2500,
        detail: "<p><img src='https://zy-image.oss-cn-hangzhou.aliyuncs.com/image/136cd364f35344e69dcb0b6f35c61ce8'></p>",
        discountPrice: 5000,
        fileInfoId: null,
        id: "1132",
        images: [
          "https://zy-image.oss-cn-hangzhou.aliyuncs.com/image/8fbfeec08677415ba9b4d897a79e7048",
          "https://zy-image.oss-cn-hangzhou.aliyuncs.com/image/021ecaac160d45e5b4fc979d080f62a9"
        ],
        infoImageUrl: "https://zy-image.oss-cn-hangzhou.aliyuncs.com/image/5872fd7dd5e64f14871d691081ff4d45",
        integral: 55,
        intro: "电脑",
        logisticFee: 0,
        mainFileId: null,
        marketPrice: 6500,
        name: "联想笔记本",
        postageFeeDesc: null,
        price: 6000,
        productWebVoList: [
          {
            id: 198,
            logoFile: "https://zy-image.oss-cn-hangzhou.aliyuncs.com/image/27b6f3e4e9604d13847fe06856f689eb",
            price: 5000,
            productId: 1132,
            url: "https://zy-image.oss-cn-hangzhou.aliyuncs.com/image/5de8595b68ea42d3ae0416fbec07b5d7",
            webId: 105,
            webName: "天猫"
          }
        ],
        profit: 0,
        putawayStatus: 1,
        quantity: 2270,
        salesVolume: 731,
        supplierId: 40,
        tags: "欢迎购买",
        type: 1,
        url: "http://localhost:8000/pages/purchaseShop/goodsDetail?id=1132&inviteId=21100",
        _href: "https://zy-image.oss-cn-hangzhou.aliyuncs.com/avatar_default.jpg",
        _userName: "孟彩红"
      },
      userInfo: ''
    };
  },
  onShow() {
    this.userInfo = this.$store.state.userInfo;
  },
  methods: {
    closePoster1 () {
      this.showPoster1 = false
    },
    closePoster2 () {
      this.showPoster2 = false
    },
    closePoster3 () {
      this.showPoster3 = false
    },
    showPosterHandler (index) {
      console.log(this.detailData, 'detailData is')
      this.detailData._userName = this.userInfo.nickName;
      this.detailData._href = this.userInfo.href;
      var url = window.location.origin + '/pages/purchaseShop/goodsDetail'
      // var url = 'https://testmartweb.tofire.cn/pages/purchaseShop/goodsDetail'
      this.detailData.url = `${url}?id=${this.detailData.id}&inviteId=${this.userInfo.userId}`
      if (index == 1) {
        this.showPoster1 = true
      } else if (index == 2) {
        this.showPoster2 = true
      } else {
        this.showPoster3 = true
      }
    }
  }
}
</script>

<style lang="scss">

</style>
